package com.chukun.module.impl;

import com.chukun.module.inf.Digest;
import com.chukun.module.inf.DigestManager;
import com.chukun.module.inf.Returned;

/**
 * @author chukun
 * @version 1.0.0
 * @description DigestManager的实现类
 * @createTime 2022年06月06日 22:18:00
 */
public class DigestManagerImpl implements DigestManager {
    @Override
    public Returned<Digest> create(String algorithm) {
        Returned<Digest> returned = switch (algorithm) {
            case "SHA-256" -> Sha256.returnedSha256;
            case "SHA-512" -> Sha512.returnedSha512;
            default -> Returned.UNDEFINED;
        };
        return returned;
    }
}
